import os
from config.conftest import *
import time
from config.WX_Robot import WXRobot
from common.Email_Handler import EmailHandler

if __name__ == "__main__":
    time_name = "test{}.html".format(time.strftime("%Y_%m_%d-%H_%M_%S", time.localtime()))
    # print(f'time_name:{time_name}')
    # pytest.main(["-vs", r'D:\11 PyCharm\ZQL\DG_Test\cases\test_get_excel_cases.py'])
    pytest.main(["-vs", r'D:\11 PyCharm\ZQL\DG_Test\cases\test_get_excel_cases.py', '--alluredir=./reports/allure', f"--html=reports/result/{time_name}", "--no-summary"])

    # 使用allure命令生成测试报告 ：allure generate 数据路径文件 -o html路径文件 -c
    cmd = 'allure generate ./reports/allure -o ./reports/allure/html --clean'
    os.system(cmd)

    # # 通过企业微信发送结果通知
    # wx_robot = WXRobot()
    # wx_robot.robot_send()


    # 发送邮件
    EmailHandler().send_email(res_email="1262613566@qq.com,526041358@qq.com")

